package com.hth.zhushanmall.search.controller;

import com.hth.zhushanmall.search.service.MallSearchService;
import com.hth.zhushanmall.search.vo.SearchParam;
import com.hth.zhushanmall.search.vo.SearchResult;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

/**
 * @Author hutianhui
 * @Date 2020/6/23
 **/
@Controller
public class SearchController {

    @Resource
    MallSearchService mallSearchService;

    /**
     * 自动将页面提交过来的所有请求查询参数封装成指定的对象
     * @param param
     * @return
     */
    @GetMapping("/list.html")
    public String listPage(SearchParam param, Model model){

        SearchResult result = mallSearchService.search(param);
        model.addAttribute("result",result);

        return "list";
    }
}
